Improved error handling for <modify> tags