delete old file.
update state test to a better way