added check if username parameter is provided