remove listeners when using the build flag

, fixes #176
Merge pull request #177 from lukeapage/patch-1

remove listeners when using the build flag