Fix type bug in encapsulator.