Fixed the type inference bug