cast type check was too restrictive