Merging fixes from 1.x of the module into 2.x