range bug fixes