#390 #391 Merged sources from pull request 411.