add more checking for getUserId()