Bugfix 13940

Has the bugfixes for 13836 and 13849 as well