Fix patch based on comments from Gerd