merge new changes from Mikael Jorhult