Fixed illegal memory access bug. Whoops! 

Thanks to Joel and Vini for emailing me about it/