SquashFS on NAND via UBI

I'm struggling with adding support for a device that has a NAND flash for storage and as (somewhat) expected, squashfs prevents the booting process by throwing a squashfs error: xz decompression failed, data probably corrupt error.

I believe it is caused by some bad blocks on the NAND so i decided to use UBI by adding this line to the profile definition inside the mt7621.mk file.

IMAGE/sysupgrade.bin := append-kernel | append-ubi | append-metadata | check-size $$$$(IMAGE_SIZE)

Isn't this supposed to use UBI as a translation layer and solve the bad blocks troubles? I'm asking because i'm getting the same errors whenever OpenWrt tries to boot; it obviously hangs immediately after these errors.

The entire profile definition of the board i'm currently trying to add support for.

define Device/na502
  DTS := NA502
  DEVICE_TITLE := Sercomm NA502
  DEVICE_PACKAGES := \
	kmod-ata-core kmod-ata-ahci kmod-sdhci-mt7620 kmod-mt7603 kmod-mt76x2 \
	kmod-usb3 kmod-usb-ledtrig-usbport wpad-mini
  BLOCKSIZE := 128k
  PAGESIZE := 2048
  IMAGE_SIZE := $(ralink_default_fw_size_128M)
  KERNEL := $(KERNEL_DTB) | pad-offset $$(BLOCKSIZE) 64 | uImage lzma
  UBINIZE_OPTS := -E 5
  IMAGE/sysupgrade.bin := append-kernel | append-ubi | append-metadata | check-size $$$$(IMAGE_SIZE)
endef
TARGET_DEVICES += na502

Thanks!