Fixed #3: OutOfMemoryError while building.

Thanks to @thunderklaus for investigating the issue and
finding the fixes.