Extract some code to separate module
Fix crashing while saving genre data
Fix TypeError if Python 3 intepreter is using