Late commits to fix some logical errors