Added proper error handling for transformations.