Improved precompile template version check

This check reduces duplicated code as well as also failing if the
template was precompiled on a version before the check was added.
Merge pull request #424 from wagenet/version-check-v2

Improved precompile template version check