Error is now returned on incorrect credentials, fixed some bugs