I think this IF statement should be before the if(!glossay.editItemFlag) one.