utils: Some changes to module functions.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
if submodules doesn't exist this will return None, which will fail on a ValueErorr since NoneType is not iterable.