Fixed some rather strange errors