Fixed OOM errors.
Fixed warnings.