finally working but with a tweak