Fixed bug in format script