better handling of debug and wake conditions