patches for bugs 987369 and 987784