Fix some logic bugs and add missing super. calls.