Bug correction + add junit test for listeners (errors, user's return code)