some fixes, tests do not yet pass