pruneSparkQueue(): fix bug when top>bottom