fixed bugs in computing previous layer initial and transitions