add safe check