add safety check function