Replace tabs with spaces. Bug fixes