indexing problem fixed by switch to numpy matrix