Fixing 1680 master

fixes #1680 
@jancborchardt @butonic @bartv2 THX