Fixed apply to use register_thread_nullary instead of ignoring the state argument