fixed missing space in SQL queries