Core: fixed few coverity issues and warnings