Backpatch from 1.x

commit 22c0facd3df838996fb92f2187da1e2924dae935
Author: Mark Ellzey <socket@gmail.com>
Date:   Mon Apr 28 11:23:26 2014 -0400

commit 0e839f0a8c9ab52d6b9250eecbadf0059398cd63
Author: zhangjing <zhangjing230@gmail.com>
Date:   Mon Apr 28 16:13:03 2014 +0800