Numerous little fixes