fix #333
misc fixes