Fixed error handling in plod