Fix misc bugs in samples