Fixed some bugs during REST refactoring.