handling null value gracefully