Fixed wrong where() clauses and fixed pdb debugging in uwsgi