Applied patch c1258.diff from Stephan Bruns (ticket:359)