fixed boundary issues