fix bugs in outputUpdate in determining context and index, closes #449
added profiling code
comment out profiling code