improve sandbox error handling