Multiple fixes

fix nil error
fix git reset command
don't need to checkout source branch