Add format chooser and fix invalid filename bug