Added a safety mechanism