Fix PR and add more debug logs