Fixes to syntax errors for database