Fix bug for boundary and reduce thread block size