Fix positional/kwarg handling of the Z argument

Fixes #2808