fixing assumed shape indexing errors