bugfixes found while writing  pseudocode