Don't remove the legacy decoder if a legacy packet is found

Removing the decoder causes the bytebuf to be passed on to the next handler to be parsed normal packet which causes an error with legacy handshakes.
Fix null pointer in depend resolution. This closes issue #515.
Merge remote-tracking branch 'upstream/master'