Fixing undefined value