Added callback tests and fixed bug where on_failure callback was erroneously called (#78)