Merge pull request #30 from abergeron/maint

Fix bugs exposed by theano