Memory crash fix (hopefully)