fixes for issues #3354 and #3340

retargeted to bootstrap3