type check to prevent crashes
clarification