Fixed the diagrams backend. Things were drawn in the wrong order.