Made init callback more robust (changed name to on-init)