Add more constness to module-related APIs