add some imports and fix some bugs