some fixes to #395