Various fixes to little detail differences between ruby and python