add generation and fix test