avoid out of bounds accesses
Merge branch 'master' of https://github.com/proebsting/cs553s2013