Fix to limit values to upper bounds on resize.
Merge pull request #73 from orangemug/bounds_checking

Fix to limit values to upper bounds on resize.