added safer module handling