Bugfixes, additions for 0.5.1