fixed a few bug fixes