fixing safety check