Fixed bugs reported by Miles