fixed a handful of bugs