wrong position of getMainWindow fuction