Fixed a few bug errors
minor bug fixes