A couplf of bugfixes