making error wrapper more robust, renaming