Enhace sdb_fmt() to handle index -1