fix some bug and add << operator