minor refactor to handle corner case