Add explicit type cast to avoid Ruby 2 type error.