Various bugfixes and some new TRNSYS functions