Fix varsub build (fix inter-module dependency issue) and catch overflow