Some bugfixes and features