Minor fixes

Just replacing str != "" with len(str) != 0 all over.