Correct decoding priority for optional variables - Fixes #8