Fixed small bugs in sh script