Fix handling of undefined/unassigned variables