Fixed up handling of variables