fix scoping of classes to include modules properly