Make custom style support actually work.

Also fix a few bugs.