fixed row indexing problem