Code lifetime bug fixed