bugfixes and more variable integration