modified error handling in cmd