remove listeners when using the build flag

fixes #176