Fixed multiple thread error and database error. Register not working