a few modification
remove a few bugs