fixed empty index issue