remove unused commands and pre-write check