Tweak casting within mask implementation

Resolves #63