Fix bug in how success/error is called