Bug fixes and some old commits that were never pushd