port some changes from mxcl/homebrew