Ruby 1.8 compatibility
More error handling