fixed some stray memory allocation errors