Add check and idle modules and fix ref semantics