Various bug fixes after 2nd demo with Yan.