Fixed issue 4, when removing all the DB related stuff from the models they local variables were removed, this caused the error.