made variable existence check first, refs #36