fix interval and starting index issue