Fixing issue when entityname is not defined