minor bugfix, added some comments