minor code bug & coding style fixed