Add occurs check and a test to make sure it works