fix samples and some bugs