Fixing crash in cave generation.