Fix dependencies to when & rest