applied and fixed the original patch

initial work on the patch import done