fix null reference reported by Tobias Lang