type checking for either and maybe