WIP update to 4.0.1.2; cleanup; TS fix