merging position_cache with error_handler
Some cleanup
fixes #9807