Getting a few unexpected errors, also no inserts are made to mysql