Fix the coverity issues

This PR is to resolve issues raised by coverity.

BUG=XWALK-2928
... And now you stop the constructor mid-way and `is_valid_` is true. Think again.