fix some trivial things
refactor mechanism codes