corrected comments and fixed a bug