some out of memory error fixes