added fixes for linux mentioned in PR #817