Combined fix for both bugs

https://bugs.eclipse.org/bugs/show_bug.cgi?id=423856
https://bugs.eclipse.org/bugs/show_bug.cgi?id=422856