Fixes range check mistake (>=getLength() needed rather than >)