Fix border and check logic.