added check for login