is_scalar should check for null first