Fix behavior differences between bash 3 and 4.