fix bug in create function