compatible with OSX 10.10, and fix a bug