fix tabbing. some extra safety checks