Happened to me before so I can really feel your frustration. What I have learned, because it's not always easy to ask for 50% upfront, is to split the project into many phases and ask for payment when a phase is implemented. Hope you won't have to deal with a client like that in the future.