Fix bug and code restyle.