fixed #4; other fixes