Fixes #2499 #2500 master