bugfixes and cleanup TODO file