Few fixes in the attribute table model

They were triggering assertions in debug mode...