fix bnc#812266 and bnc#804149

fix bnc#812266 and bnc#804149