made the itemmodalwork and error catch in my code