fix ruby warnings, fix #2047