Fix for AE-274

This fixes AE-274, please review and integrate this, and close the issue then.