Fix behaviour on error