Added getopt for older python versions. Fixed empty sample set bug -> div by 0'