check before remove file