add some specs, fix some bugs