Added test code for module functions
Fixed a bug that caused a crash if a branch has no type