fix some issues including #164