Fixed duplicated format index and adding logging

see comment on 8cb856f