Fixed check for null