Add a catch for classcastexception when casting to Module