Really fix issue #405 and #536.

Conflicts:
	src/mainwindow.cpp