Various fixes helping to pass validation (http://re.cs.uct.ac.za/)