Fix Travis config and some bugs.