Added border checking for camera