Example bugfixes and improvement