Little improvements and sample bug fixes