Debug session: handle port numbers correctly and add clearPeekBuffer