Bug Fixes in Main, updated version