Fixed bugs in create and delete