Fixed errors in function that checks if