Fixing type errors