fix type error with self.apply