A5: Fixed bug in solution

- Damnit, figured this one out *after* submissions ended. Oh well...