fix compile error on ubuntu 13.10
some refactor