Updated some environment detection. Perhaps this resolves #39?