fixed out of memory issues