remove unused vars & fix %x formats