Fix bug in new code