fix function for detect current wmname