Fixes broken error handling