Fixed issue 39 by ensuring pixels array is the correct size before trying to read to it.