solving border problem