some fixes and clean-ups

some fixes for bnc#804065 and bnc#796917 and clean-ups