Fixes an illegal memory access error