--- /buddypress/bp-xprofile/bp-xprofile-templatetags.php	Mon Dec 13 12:28:24 2010
+++ /buddypress/bp-xprofile/bp-xprofile-templatetags.php	Mon Dec 13 12:44:09 2010
@@ -187,10 +187,10 @@
 		if ( $class )
 			$css_classes[] = sanitize_title( esc_attr( $class ) );
 
-		/* Set a class with the field ID */
+		// Set a class with the field ID
 		$css_classes[] = 'field_' . $profile_template->field->id;
 
-		/* Set a class with the field name (sanitized) */
+		// Set a class with the field name (sanitized)
 		$css_classes[] = 'field_' . sanitize_title( $profile_template->field->name );
 
 		if ( $profile_template->current_field % 2 == 1 )
@@ -387,7 +387,7 @@
 					$option_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id ) );
 					$option_values = (array)$option_values;
 
-					/* Check for updated posted values, but errors preventing them from being saved first time */
+					// Check for updated posted values, but errors preventing them from being saved first time
 					foreach( (array)$option_values as $i => $option_value ) {
 						if ( isset( $_POST['field_' . $field->id] ) && $_POST['field_' . $field->id] != $option_value ) {
 							if ( !empty( $_POST['field_' . $field->id] ) )
@@ -411,7 +411,7 @@
 				for ( $k = 0; $k < count($options); $k++ ) {
 					$option_value = BP_XProfile_ProfileData::get_value_byid($options[$k]->parent_id);
 
-					/* Check for updated posted values, but errors preventing them from being saved first time */
+					// Check for updated posted values, but errors preventing them from being saved first time
 					if ( isset( $_POST['field_' . $field->id] ) && $option_value != $_POST['field_' . $field->id] ) {
 						if ( !empty( $_POST['field_' . $field->id] ) )
 							$option_value = $_POST['field_' . $field->id];
@@ -432,7 +432,7 @@
 			case 'checkbox':
 				$option_values = BP_XProfile_ProfileData::get_value_byid($options[0]->parent_id);
 
-				/* Check for updated posted values, but errors preventing them from being saved first time */
+				// Check for updated posted values, but errors preventing them from being saved first time
 				if ( isset( $_POST['field_' . $field->id] ) && $option_values != maybe_serialize( $_POST['field_' . $field->id] ) ) {
 					if ( !empty( $_POST['field_' . $field->id] ) )
 						$option_values = $_POST['field_' . $field->id];
@@ -454,15 +454,16 @@
 				break;
 
 			case 'datebox':
+				$date = BP_XProfile_ProfileData::get_value_byid($field->id);
 
-				if ( !empty( $field->data->value ) ) {
-					$day = date("j", $field->data->value);
-					$month = date("F", $field->data->value);
-					$year = date("Y", $field->data->value);
+				if ( !empty( $date ) ) {
+					$day = date("j", $date);
+					$month = date("F", $date);
+					$year = date("Y", $date);
 					$default_select = ' selected="selected"';
 				}
 
-				/* Check for updated posted values, but errors preventing them from being saved first time */
+				// Check for updated posted values, but errors preventing them from being saved first time
 				if ( !empty( $_POST['field_' . $field->id . '_day'] ) ) {
 					if ( $day != $_POST['field_' . $field->id . '_day'] )
 						$day = $_POST['field_' . $field->id . '_day'];
@@ -529,8 +530,8 @@
 						break;
 				}
 
-				apply_filters( 'bp_get_the_profile_field_datebox', $html, $day, $month, $year, $default_select );
-
+				
+				$html = apply_filters( 'bp_get_the_profile_field_datebox', $html, $type, $day, $month, $year, $default_select );
 				break;
 		}
 
