fixed database conversion artifact, wrong column name
fixed sql table names capitalization
fixed if-error resulting from missing curly braces, fixed mistake in curring sql query parameters