fixing bugs and updating shell script