fixed leaking problem, empty range error now