Partially fixed most bugs in samples class.