fix lost before/after sub bug