fix for JAL-1380 and efficiency todo for JAL-1381