improved zrange and zrevrange to handle empty results better