Issue #783: python3 compatible - fixed a hidden bug.
Issue #783: python3 compatible - fixed remaining test failures.

Python 3 port now passes default "theano-nose" tests under pythobn 3.2.