fixed NaN calculation error and tried to delete messages through associations