improved username detection