few bug fixes in my code