updated patch and fixed errors