Fix for coverity issue 51780 and 51781
Fix for coverity issue 51684