Fix some of stackoverflow exceptions