fix bug in create/update entity existence validation