break after error callback. Thanks to caojie.