fixed two hiccups, and tested on mac