Various frontend related fixes

fixes #1997 and #1982