Fix #2790

Fixes #2790 - Tested and verified to work (at least for me). Any feedback is appreciated as I am just starting to learn ruby