Fixes out of memory issues.