Register function works and register users in DB