Fixed invalid SQL statement error