Fix bug where attributes were not returned correctly