Remove some dead code
Fix a type inference issue