added error handling for debug statement