Better error message when block option when a variable does not appear at current period.

(cherry picked from commit 46a0edb9b30a17396d29dde69cb9fa68759648e8)