Fix type inference bug (Issue #138)