made run on Mac again (added exception handling, fixed param bugs)