Add tests, fix respond-error