Added some boundary checks for sample background