Improved gender detection, bug fix