bugfix: out of bounds errors