Fix type errors