Let's do an extra check if the mod_handle is actually valid

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>