fixed code and inserted bug-note