Error handling in script added