fix FreshRunReq/NoSuchElementException exceptions in twirl compiler; ported from play 2.0 pull req 590 by jroper