Moved open before setting attributes.