a couple of bugs after the code re-write