Fixed return value bug