Improved error handling for EXEC command