added basic weak type inference