fixed some bugs and refactored junction's spec