Merging bug fixes from the master branch.