Fixed issue when using a BETWEEN condition