Hello, im working on a Autofarmer, and im running into a small issue. When i place the hopper, it should set the blocks in a 5x5 area to farmland. It will set the blocks to farmland just fine. But i want to set the blocks above the farm land to wheat. When i place the hopper, it will replace the blocks under them also. Its hard to explain what i m talking about, so ill post a pic. I dont want it to break the blocks on the outside like its doing in the video. If someone knows whats wrong, please let me know ASAP. 
Thanks!
~Matt
Vid of whats happening:
https://gyazo.com/b41acb6197f524cef41cfd09b90e260d
Code:
Thanks!
~Matt
Vid of whats happening:
https://gyazo.com/b41acb6197f524cef41cfd09b90e260d
Code:
Code:
on place:
if line 1 of lore of player's held item contains "Basic":
set {autoplanter::%player%} to location at event-block
loop blocks in radius 5 around {autoplanter::%player%}:
if loop-block is a hopper:
if loop-block.getState().getCustomName() is "&aAutoplanter Basic":
loop blocks in radius 5 around {autoplanter::%player%}:
if loop-block-2 is grass block or dirt:
set loop-block-2 to farmland
set block below {autoplanter::%player%} to water
set block above loop-block-2 to wheat