Fixes for DEVELOPER-939, DEVELOPER-959

See the associated commit in aweplug:
https://github.com/awestruct/aweplug/commit/2410212db9dbb9eab2c2bdd0ac3100eb997bbcbb
for more information.