re-applying changes from pull/236 which were overwritten