fixed #18; other fixes