Stabilize error handling

Performance and stability improvements