Fixed a few small bugs in the backend.