first round bugfixes for eventual porting to precalc slots file for refactor.