[WIP] Fix scan merge inouts

This should fix one of the bugs reported by Sigurd at https://groups.google.com/d/topic/theano-users/vdSe8EH1kZM/discussion