Rectify error in checking for a null input