fixed out of memory segfault