Fixed terrain bugs