Re-applying part of commit fb3e67c35 reverted by mistake