programs modified and fix some errors