improved BYE behaviour and bugfixes