Wrap options in braces to satisfy Ruby 1.8.
Change options handling to be more robust.