Bug fixes

Didn't work properly when called from HTML block