Ok, i found the problems. First problem the complete code is not pep8 and mixes tabs...
complete broken