Fixed bugs when adding and updating items (REST)