Fix genus compute and some if statement