Fixed generation of WR (was WE)

Also added a test file