fixes a memory allocation bug just introduced