Bugfixes for code in Ruby/Go