Fix crashes due to auto-type in Python

These two commits do fix crashes caused by auto-type feature in Python. We expect instance of one type, however Python automatically creates instance of int/str which doesn't have or isn't capable of wanted operations.