adding checks for null and default values to getValue()

updating null checks and adding default values to getValue()