corrected a few things

thanks to the guys on #bash and shellcheck.net