Minor fixes, still needed some further tests