Script: add debug mode, and some assertions & label lookups in-mem