Fixed obivous code bugs, solved issue with mac run script.