some fix on the code