fixes for #2346 #2303
Merge pull request #2351 from jpuri/master

fixes for #2346 #2303