Improve dependency registering and expression validation