fix compile error and some smaller tweaks