Some bug fixes for qt 5