Several edge bugs fixed