added bug fixes from sajnikanth.com