minor fixes, now tested