Added boundaries correction