using lenient version of flatten
upgraded gem version