improving wrapper
fixing bug in calling insert(entity)