padding bug autodetection improvement 2nd try