fixed circular reference

working on #4 and #7