added a safety so that it doesn't crash