Ruby script modified - code works correctly.