Fixed some SQL injection bugs.