[#1821] Fix IndexOutOfBoundsException which was thrown if the last component was removed but other components was left
Set memory for compiler as otherwise it sometimes fails here