fixes #535
fixes #511