logic fixes for exercise #1.5