bug fixes and few style changes