Fixed stuff by reverted to old state
Merge pull request #568 from jaypoulz/retrieveMainWindow

Fixed stuff by reverted to old state