Fix more case-sensitivity issues

before/after/beforelast/afterlast all were case sensitive