Bugfixes copied from 201301
initial commit