add null check for password