fix nil pointer err