Bug fixes

update to the latest file after new tests.