Fixed issue with border determination - #1358