fixed out of memory errors