added safeguard for unfilled inputs