use mysqli for escaping input string. fix some errors logged to system.log