sage and noko bugfixes. my 2011 code was falling apart