Fix type errors and naming mistake