check for null earlier