Updating sample programs and bugfixes