Fixes #3 (mac compilation);fixes #4