I think the following will fix this problem:
function get_data( $field_name, $group_index=1, $field_index=1, $post_id ){
global $wpdb;
$field_name = str_replace(" ","_",$field_name);
$sql = sprintf(
"SELECT m.meta_id,w.meta_value,f.type,f.options,f.description,f.label " .
"FROM %s m " .
"JOIN %s w ON m.meta_id = w.meta_id " .
"JOIN %s f ON m.field_name = f.name " .
"JOIN %s p ON w.post_id = p.ID " .
"WHERE m.post_id = %d AND m.field_name = '%s' AND m.group_count = %d AND m.field_count = %d AND f.post_type = p.post_type",
MF_TABLE_POST_META,
$wpdb->postmeta,
MF_TABLE_CUSTOM_FIELDS,
$wpdb->posts,
$post_id,
$field_name,
$group_index,
$field_index
);
$result = $wpdb->get_row($sql,ARRAY_A);
if( empty($result) ) return NULL;
$result['options'] = unserialize($result['options']);
if(is_serialized($result['meta_value'])){
$result['meta_value'] = unserialize( $result['meta_value'] );
}
return $result;
}