Lots of fixes for SQL injections