some bug fixes
- fixed a number of bugs