fixed bug where array lengths would not be consumed properly, creating arrays of increasing size