deferred/promise and error handling tweaks