r509 compatibility and retab to 2 spaces

This is all dependent on git master r509.