Debug error message in stop function