Fixed bugs in back-end.