Added function to check if user filled in correct password.

If this check is not done the script returns in an endless loop.