fix bug in iterator, fix style