fix format function