I've done it with an array. That zorder action wont really work here. Say you have an instance variable "z" for both sprite and tiledbg.
Every tick
-- array: set size to (0, 2, 1)
for each sprite
-- array: push sprite.z to front x
-- array: set at (0,1) to sprite.uid
for each tiledbg
-- array: push tiledbg.z to front x
-- array: set at (0,1) to tiledbg.uid
every tick
-- array: sort x
array: for each x
-- sprite: pick by uid array.at(array.curx,1)
----- sprite: send to front
-- tiledbg: pick by uid array.at(array.curx,1)
----- tiledbg: send to front