#374 Re-applied lost fixes