Many small bug fixes, and improved HTTP API responses.