Improve error handling in pk7_doit