Severa minor fixes (see commits)

The `val` variable you create here is not used afterward, so this line does nothing.