green caves fix some undefined behavior (hopefully)