fixed demonize function