Fixed some bugs detected by updated api mock.