Modules: Fixed uninitialized value and added a few checks.

Signed-off-by: Domen Ipavec <domen@domen-pi.(none)>