replace spaces with tabs, fix most validation errors