Added safety check