fix bug with new code