bash: more fixes from upstream
Merge pull request #798 from pyhalov/bash

bash: more fixes from upstream