add mutation check and clean some garbage