added method to check if given password is correct