Fixed return value in queue function