changes from https://github.com/jterrace/sphinxtr so it actually works